package types

// ValidCodeType
//
//	验证码类型
//
//	1-邮件注册 2-短信
type ValidCodeType int

const (
	ValidCodeTypeEmail ValidCodeType = 1

	ValidCodeTypePhone ValidCodeType = -1
)

func (v ValidCodeType) Name() string {
	switch v {
	case ValidCodeTypeEmail:
		return "email"
	case ValidCodeTypePhone:
		return "phone"
	default:
		return "unknown"
	}
}
func (v ValidCodeType) Value() int {
	return int(v)
}
func (v ValidCodeType) IsValid() bool {
	switch v {
	case ValidCodeTypeEmail, ValidCodeTypePhone:
		return true
	default:
		return false
	}
}
func (v ValidCodeType) IsEmail() bool {
	return v == ValidCodeTypeEmail
}
func (v ValidCodeType) IsPhone() bool {
	return v == ValidCodeTypePhone
}
